package com.epsoft.odin7cj.flow.example;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

public class C12BoundaryEvent {
	public static void main1(String[] args) throws Exception {
		
		ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
		
		RepositoryService repositoryService = engine.getRepositoryService();
		
		RuntimeService runService = engine.getRuntimeService();
		
		TaskService ts = engine.getTaskService();
		
		Deployment deployment = repositoryService.createDeployment().addClasspathResource("bpmn/c12-boundary-event.bpmn").deploy();
		
		ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
		
		ProcessInstance pi = runService.startProcessInstanceById(pd.getId());
		
		Task task = ts.createTaskQuery().processInstanceId(pi.getId()).singleResult();
		
		System.out.println("节点："+task.getName());
		
		Thread.sleep(1000*70);
		
        task = ts.createTaskQuery().processInstanceId(pi.getId()).singleResult();
		
		System.out.println("节点："+task.getName());
	}
}
